/* Reset & base */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  color: #0f172a;
  background: #f8fafc;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app { min-height: 100%; display: flex; flex-direction: column; }
.container { max-width: 480px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 10; background: rgba(248,250,252,.8); backdrop-filter: blur(8px); border-bottom: 1px solid rgba(15,23,42,.06); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; padding: 14px 0; }
.brand-mark { display:inline-block; width: 10px;  color:#0ea5e9; }
.brand-name { color: #0f172a; font-weight: 700; letter-spacing: .3px; font-size: 18px; }
.brand-pro { color: #0ea5e9; }

/* Main */
.site-main { flex: 1 1 auto; padding-bottom: calc(env(safe-area-inset-bottom) + 64px); }

.hero { padding: 48px 0 24px; text-align: center; }
.hero-title { font-size: clamp(20px, 3.5vw + 10px, 40px); margin: 8px 0 12px; letter-spacing: .2px; }
.hero-sub { color: #475569; margin: 0 0 20px; }
.hero-cta { display: inline-flex; gap: 12px; }

.btn { appearance: none; border: 1px solid rgba(15,23,42,.12); background: #fff; color: #0f172a; border-radius: 10px; padding: 10px 16px; cursor: pointer; transition: transform .08s ease, box-shadow .2s ease, background .2s ease; }
.btn:hover { box-shadow: 0 6px 16px rgba(2,6,23,.08); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary { background: #0ea5e9; border-color: #0ea5e9; color: #fff; }

.section { padding: 24px 0; }
.view { display: none; opacity: 0; transform: translateY(8px); transition: opacity .25s ease, transform .25s ease; }
.view.is-active { display: block; opacity: 1; transform: translateY(0); }

/* Forms */
.auth { display: grid; gap: 16px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: rgba(15,23,42,.06); padding: 4px; border-radius: 10px; }
.seg-btn { border: 0; background: transparent; padding: 10px 8px; border-radius: 8px; color: #334155; cursor: pointer; }
.seg-btn.is-active { background: #fff; color: #0f172a; box-shadow: 0 2px 8px rgba(2,6,23,.08); }
.form { display: grid; gap: 12px; }
.field { display: grid; gap: 6px; }
.input { width: 100%; height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(15,23,42,.12); background: #fff; color: #0f172a; }
.input:focus { outline: none; border-color: #0ea5e9; box-shadow: 0 0 0 3px rgba(14,165,233,.15); }
.form-msg { min-height: 18px; font-size: 12px; color: #0ea5e9; }
.is-hidden { display: none !important; }

/* Cards & lists */
.cards { display: grid; gap: 12px; }
.card { background: #fff; border: 1px solid rgba(15,23,42,.08); border-radius: 12px; padding: 12px; box-shadow: 0 4px 12px rgba(2,6,23,.04); }
.card-title { margin: 0 0 8px; font-size: 14px; color: #334155; }
.card-clickable { cursor: pointer; transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease; }
.card-clickable:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(2,6,23,.08); border-color: rgba(14,165,233,.3); }
.card-clickable:active { transform: translateY(0); }

/* Portfolio card */
.portfolio { font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial; }
.portfolio .pf-section { margin: 8px 0 12px; }
.portfolio .pf-title { display:flex; align-items:center; gap:8px; font-weight:600; color:black; }
.portfolio .pf-divider { height:1px; background:rgba(226,232,240,.2); margin:6px 0 10px; }
.portfolio .pf-grid { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:10px; }
.portfolio .pf-kpi { background: rgba(15,23,42,.35); border:1px solid rgba(226,232,240,.1); border-radius:10px; padding:10px; display: flex; justify-content: space-between; align-items: center; }
.portfolio .pf-kpi .k { color:black; font-size:14px; }
.portfolio .pf-kpi .v { color:#f8fafc; font-size:18px; font-weight:700; }
.portfolio .pf-list { list-style:none; padding:0; margin:0; display:grid; gap:8px; }
.portfolio .pf-item { background: rgba(15,23,42,.35); border:1px solid rgba(226,232,240,.1); border-radius:10px; padding:8px 10px; color:black; }
.portfolio .muted { color:black; }
.portfolio .pos { color:#10b981; }
.portfolio .neg { color:#ef4444; }

.exchange-segment {
  flex-shrink: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 5px;
  box-sizing: border-box;
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  position: relative;
  border-right: 1px solid rgba(255,255,255,0.1);
  transition: all 0.3s ease-in-out;
}

.exchange-segment:last-child {
  border-right: none;
}

.exchange-segment:hover {
  transform: scaleY(1.02);
  box-shadow: 0 0 15px rgba(255,255,255,0.2);
  z-index: 1;
}

.exchange-label {
  text-align: center;
  padding-bottom: 3px;
  font-size: 12px;
  font-weight: 600;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asset-segment-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  flex-grow: 1;
  border-top: 1px solid rgba(255,255,255,0.2);
  padding-top: 3px;
}

.asset-segment {
  flex-shrink: 0;
  height: 18px;
  line-height: 18px;
  text-align: center;
  color: #fff;
  font-size: 10px;
  font-weight: 400;
  margin-bottom: 2px;
  border-radius: 3px;
  opacity: 0.8;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: background-color 0.3s ease;
}

.asset-segment:last-child {
  margin-bottom: 0;
}

.asset-segment:hover {
  opacity: 1;
  box-shadow: 0 0 8px rgba(255,255,255,0.3);
}
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.list li { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.muted { color: #94a3b8; }
.pre { background: #0b1220; color: #e2e8f0; padding: 8px; border-radius: 8px; overflow: auto; font-size: 12px; }
.authed-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.authed-main { display: grid; }
.authed-main .sub { color: #64748b; margin: 2px 0 0; font-size: 12px; }

/* Bottom Tabbar */
.tabbar { position: fixed; bottom: 0; left: 50%; right: auto; transform: translateX(-50%); width: 100%;max-width: 520px;margin-left: 20px; z-index: 15; padding-bottom: env(safe-area-inset-bottom); background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-top: 1px solid rgba(15,23,42,.08); }
.tabbar-list { list-style: none; margin: 0; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.tab-item { text-align: center; }
.tab-btn { width: 100%; border: 0; background: transparent; color: #334155; padding: 8px 6px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; transition: background .2s ease, color .2s ease, transform .08s ease; }
.tab-btn:active { transform: translateY(0.5px); }
.tab-item.is-active .tab-btn { color: #0ea5e9; background: rgba(14,165,233,.08); }
.tab-icon { display: inline-flex; }
.tab-label { font-size: 12px; }

/* 移除桌面端特化：保持全设备为移动端布局 */

/* 表格 & 弹窗 */
.table-wrap { overflow: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 8px; border-bottom: 1px solid rgba(15,23,42,.08); text-align: left; font-size: 13px; }
.modal { position: fixed; inset: 0; display: grid; place-items: center; }
.modal.is-hidden { display: none !important; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(2,6,23,.55); }
.modal-panel { position: relative; background: #fff; border-radius: 12px; padding: 16px; width: min(92vw, 480px); box-shadow: 0 12px 30px rgba(2,6,23,.24); }
.modal-title { margin: 0 0 10px; font-size: 16px; }

/* Dark mode */
@media (prefers-color-scheme: dark) {
  body { color: #e2e8f0; background: #0b1220; }
  .site-header { background: rgba(2,6,23,.6); border-bottom-color: rgba(148,163,184,.12); }
  .brand-name { color: #e2e8f0; }
  .btn { border-color: rgba(148,163,184,.16); background: #0f172a; color: #e2e8f0; }
  .btn.primary { background: #0ea5e9; border-color: #0ea5e9; color: #02131c; }
  .tabbar { background: rgba(2,6,23,.75); border-top-color: rgba(148,163,184,.16); }
  .tab-btn { color: #94a3b8; }
  .custom-select-selected { background: #0f172a; color: #e2e8f0; border-color: rgba(148,163,184,.16); }
  .custom-select-options { background: #0f172a; border-color: rgba(148,163,184,.16); }
  .custom-select-option span { color: #e2e8f0; }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .view { transition: none; }
  .btn, .tab-btn { transition: none; }
}

.loading { color: #0ea5e9; }
.error { color: #ef4444; }

/* Custom Select with Exchange Logos */
.custom-select-selected:hover {
  border-color: rgba(14,165,233,.3);
}

.custom-select-selected:focus-within {
  outline: none;
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14,165,233,.15);
}

.custom-select-options {
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.custom-select-options::-webkit-scrollbar {
  width: 6px;
}

.custom-select-options::-webkit-scrollbar-track {
  background: rgba(15,23,42,.04);
  border-radius: 3px;
}

.custom-select-options::-webkit-scrollbar-thumb {
  background: rgba(15,23,42,.2);
  border-radius: 3px;
}

.custom-select-options::-webkit-scrollbar-thumb:hover {
  background: rgba(15,23,42,.3);
}

/* 代币分配柱状图样式 */
.token-chart-container {
  margin: 16px 0;
  background: transparent;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.token-chart {
  display: flex;
  flex-direction: column;
  height: 300px;
  position: relative;
}

.chart-y-axis {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 40px;
  width: 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  padding-right: 8px;
}

.y-label {
  position: absolute;
  top: 30%;
  transform: rotate(-90deg);
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
}

.chart-bars {
  margin-left: 60px;
  margin-right: 40px;
  height: calc(100% - 40px);
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  padding: 0 8px;
  gap: 4px;
}

.chart-bar {
  flex: 1;
  min-width: 8px;
  border-radius: 2px 2px 0 0;
  transition: all 0.2s ease;
  cursor: pointer;
}

.chart-bar:hover {
  opacity: 0.8;
  transform: scaleY(1.05);
}

.chart-x-axis {
  margin-left: 60px;
  margin-right: 40px;
  height: 40px;
  display: flex;
  align-items: center;
}

.x-label {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}

.x-ticks {
  display: flex;
  justify-content: space-around;
  width: 100%;
  padding: 0 8px;
  gap: 4px;
}

.x-tick {
  font-size: 10px;
  color: #6b7280;
  white-space: nowrap;
  transform-origin: center;
  text-align: center;
  max-width: 40px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 暗色主题适配 */
@media (prefers-color-scheme: dark) {
  .token-chart-container {
    background: transparent;
    color: #f9fafb;
  }
  
  .y-label,
  .y-tick,
  .x-label,
  .x-tick {
    color: #9ca3af;
  }
}

/* 广播分组样式 */
.broadcast-group-item {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  background: #ffffff;
  transition: all 0.2s ease;
}

.broadcast-group-item:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
  transform: translateY(-1px);
}

.broadcast-group-item.joined {
  border-color: #10b981;
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
}

.broadcast-group-item.joined:hover {
  border-color: #059669;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.group-name {
  font-weight: 600;
  font-size: 16px;
  color: #1f2937;
}

.group-member-count {
  font-size: 12px;
  color: #6b7280;
  background: #f3f4f6;
  padding: 4px 8px;
  border-radius: 12px;
}

.group-description {
  color: #374151;
  line-height: 1.5;
  margin-bottom: 12px;
  font-size: 14px;
}

.group-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.group-actions .btn {
  padding: 8px 16px;
  font-size: 14px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.group-actions .btn.primary {
  background: #3b82f6;
  color: white;
  border: none;
}

.group-actions .btn.primary:hover {
  background: #2563eb;
  transform: translateY(-1px);
}

.group-actions .btn.danger {
  background: #ef4444;
  color: white;
  border: none;
}

.group-actions .btn.danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

/* 暗色主题下的广播分组样式 */
@media (prefers-color-scheme: dark) {
  .broadcast-group-item {
    background: #1f2937;
    border-color: #374151;
  }
  
  .broadcast-group-item:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
  }
  
  .broadcast-group-item.joined {
    border-color: #10b981;
    background: linear-gradient(135deg, #1f2937 0%, #064e3b 100%);
  }
  
  .broadcast-group-item.joined:hover {
    border-color: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
  }
  
  .group-name {
    color: #f9fafb;
  }
  
  .group-member-count {
    color: #d1d5db;
    background: #374151;
  }
  
  .group-description {
    color: #d1d5db;
  }
}

/* 广播分组交易所信息样式 */
.group-exchange {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  padding: 6px 12px;
  background: rgba(14, 165, 233, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(14, 165, 233, 0.2);
}

.exchange-label {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

.exchange-name {
  font-size: 13px;
  color: #0ea5e9;
  font-weight: 600;
  background: rgba(14, 165, 233, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
}

/* 暗色模式下的交易所信息样式 */
@media (prefers-color-scheme: dark) {
  .group-exchange {
    background: rgba(14, 165, 233, 0.15);
    border-color: rgba(14, 165, 233, 0.3);
  }
  
  .exchange-label {
    color: #94a3b8;
  }
  
  .exchange-name {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
  }
}

/* Portfolio Summary Styles */
.portfolio-summary {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.account-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(15,23,42,.04);
  border-radius: 8px;
  border: 1px solid rgba(15,23,42,.08);
}

.account-name {
  color: #475569;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.exchange-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  border-radius: 2px;
}

.exchange-name {
  font-size: 14px;
  color: #374151;
  font-weight: 500;
}

.account-equity {
  color: #0f172a;
  font-weight: 600;
  font-size: 16px;
}

.portfolio-total {
  padding: 12px;
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  border-radius: 10px;
  color: #fff;
  text-align: center;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(14,165,233,.25);
}

.portfolio-total strong {
  font-size: 20px;
  font-weight: 700;
}

/* Dashboard Stats Styles - 匹配照片中的横向仪表板 */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 20px;
  padding: 20px;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

/* 为资金概览添加特殊样式 */
.dashboard-stats .stat-item:first-child .stat-value {
  color: #10b981; /* 总金额用绿色突出显示 */
  font-size: 26px;
}

.dashboard-stats .stat-item:nth-child(2) .stat-value {
  color: #3b82f6; /* 现货金额用蓝色 */
}

.dashboard-stats .stat-item:nth-child(3) .stat-value {
  color: #f59e0b; /* 合约金额用橙色 */
}

.dashboard-stats .stat-item:last-child .stat-value {
  color: #8b5cf6; /* 账户数量用紫色 */
}

.stat-item {
  text-align: center;
  color: #fff;
}

.stat-title {
  font-size: 14px;
  color: #94a3b8;
  margin-bottom: 8px;
  font-weight: 500;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .dashboard-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 16px;
  }
  
  .stat-value {
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  .dashboard-stats {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }
  
  .stat-value {
    font-size: 18px;
  }
}

/* 简化的柱状图样式 */
.simple-chart {
  margin-top: 24px;
  padding: 20px;
  background: #0f0f0f;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.chart-title {
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 20px 0;
  text-align: left;
}

.chart-bars-container {
  display: flex;
  align-items: flex-start;
  gap: 2px;
  height: 200px;
  padding: 10px;
  background: #0f0f0f;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  flex-direction: row-reverse;
}

.bar-item {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  flex: 1;
  height: 100%;
  position: relative;
}

.bar {
  width: 100%;
  min-height: 2px;
  border-radius: 2px 2px 0 0;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.bar:hover {
  transform: scaleY(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.bar-label {
  color: #94a3b8;
  font-size: 8px;
  margin-top: 4px;
  text-align: center;
  transform: rotate(90deg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 20px;
  font-weight: 500;
}

/* 柱状图悬停提示样式 */
.bar-tooltip {
  position: absolute;
  z-index: 1000;
  pointer-events: none;
}

.tooltip-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 2px;
  color: #fff;
}

.tooltip-value {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .chart-bars-container {
    height: 180px;
  }
  
  .bar-label {
    font-size: 7px;
    max-width: 15px;
  }
}

@media (max-width: 480px) {
  .chart-bars-container {
    height: 160px;
  }
  
  .bar-label {
    font-size: 6px;
    max-width: 12px;
  }
}


